package cn.iocoder.yudao.module.reading.enums.plan;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 阅读计划状态枚举
 *
 * @author 芋道源码
 */
@AllArgsConstructor
@Getter
public enum PlanStatusEnum {

    ACTIVE("active", "进行中"),
    PAUSED("paused", "暂停"),
    COMPLETED("completed", "已完成"),
    CANCELLED("cancelled", "已取消");

    /**
     * 状态代码
     */
    private final String code;
    /**
     * 状态名称
     */
    private final String name;

    public static PlanStatusEnum fromCode(String code) {
        for (PlanStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

}
